home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_218 / mandel / doc / mandel.man < prev    next >
Text File  |  1992-05-06  |  41KB  |  859 lines

  1.  
  2.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  3.  
  4.  
  5.  
  6.      ›1mCREDITS for Mandelbrot Generator 
  7.  
  8.           ›0mThis  document  describes  some  of the many features of the
  9.           ›1mMandelbrot ›0mgeneration program (revision #180), as written by 
  10.  
  11.                Olaf Seibert, KosmoSoft
  12.                Beek 5                      or  Vossendijk 149
  13.                5815 CS  Merselo                6534 TN  Nijmegen
  14.                The Netherlands                 The Netherlands
  15.  
  16.      ›1mHi›0m!  
  17.  
  18.                I assume that you are familiar with  the  operation  of
  19.           the  Amiga with respect to windows, gadgets, screens and all
  20.           other Intuition features.   (And  if  not,  just  go  RTFM).
  21.           Therefore,   I  will  ›3mnot  ›0mlist  everything  in  menu-order.
  22.           Rather, I will only make some comments  at  some  (most)  of
  23.           them.  
  24.  
  25.                When  ›1mMandel  ›0mstarts  up, it opens a screen of the same
  26.           size as your current Workbench screen, but in lo-res with  5
  27.           planes.  
  28.           ›1mNOTE›0m: There seems to be a (software) graphics bug when I try
  29.           to  open  a hires screen with a size of 672x266 (x4) pixels.
  30.           The part below about  line  213  is  simply  not  displayed,
  31.           though it is 'there'. Lores screens are not affected by this
  32.           bug  (It's  gotta  be Dale's :-) I suspect the problem is in
  33.           the system function MrgCop() (in the  graphics.library),  or
  34.           something  related  to  that,  since other programs have the
  35.           same problem.  (Maybe the problem will go away with  Release
  36.           1.4 of Kickstart/Workbench.) Therefore, I forcibly make wide
  37.           hi-res  screens a bit smaller, which may surprise you if you
  38.           are unaware of the reason.  
  39.  
  40.  
  41.      ›1mMOUSE OPERATIONS 
  42.           ›0mWith the mouse, you can select a  rectangular  part  of  the
  43.           picture that  you  may  later  enlarge  or reduce.  To start
  44.           selecting, you click the mouse in  the  inner  part  of  the
  45.           window.   Then  you  can  click  two opposite corners of the
  46.           desired rectangle.  You may also double-click  to  select  a
  47.           middle point of the rectangle.  Then you only have to select
  48.           one corner.    If  you dislike the resulting flashing frame,
  49.           you can remove it by clicking in the  sizing  gadget.    The
  50.           area you selected in the picture will remain valid until you
  51.           begin  reselecting  or  change the coordinates of the entire
  52.           picture.  
  53.  
  54.                You will notice that as  soon  as  the  flashing  cross
  55.           appears,  a  window  pops  up  with  the  coordinates of the
  56.           current position.    Normally  it  stays  there  until   the
  57.           flashing rectangle disappears.  In fact, it is updated every
  58.           time the  lines  flash.    Since  this  takes some time, the
  59.           flashing may become aestetically unpleasant.  Therefore  the
  60.           ›3mRe and Im ›0mwindow has a close box, which you are free to use,
  61.           and which will speed up the flashing.  
  62.  
  63.  
  64.  
  65.      5 May 1989                       -1-
  66.  
  67.  
  68.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  69.  
  70.  
  71.                Sometimes  a  function  will use a point as selected by
  72.           the mouse.  This will work  from  the  moment  the  flashing
  73.           lines  appear until they disappear, even if you close the ›3mRe
  74.           and Im ›0mwindow in the meantime.  
  75.  
  76.      ›1mProject›0m: ›1mNew 
  77.           ›0mWith this submenu you can create new pictures.    They  will
  78.           always  fill  your  window,  even  if the ratio of width and
  79.           height is ridiculous.  The ›3mratio ›0mnumber that appears in  the
  80.           coordinates  requester  should  be about 1.00. If it is much
  81.           more  or  less  than  this,  your  picture   will   be   not
  82.           representative of  the  ›1mMandelbrot  set›0m.    If  it  is,  for
  83.           example, 2.00, this means that the  height  of  the  current
  84.           window is  twice  the  size  it normally should be.  It also
  85.           says you to select a wider  area  from  the  complex  plane.
  86.           This  number is updated each time you press return in one of
  87.           the string gadgets.  You may have resized the window in  the
  88.           meantime.  
  89.  
  90.           With  ›1menlarge  ›0myou can enlarge a part of the current picture
  91.           as you indicated with the mouse.  
  92.  
  93.           With ›1mreduce ›0myou can reduce the current picture to an area as
  94.           large as the area you indicated, which is  located  at  that
  95.           place.   This  is  useful to see some of the surroundings of
  96.           the current picture.  
  97.  
  98.           The ›1mshift ›0msubitem is somewhat special.  A value of 0.5 means
  99.           that the new range you want to see is  shifted  0.5  of  the
  100.           size of the current range.  
  101.  
  102.           With  ›1mzoom  in  ›0mor  ›1mzoom out ›0myou can zoom in or out around a
  103.           center with a certain (linear) factor.  The center point  is
  104.           either given with the mouse (the position from the ›3mRe and Im
  105.           ›0mwindow)  or  otherwise  the center of the current picture is
  106.           taken.  This value is not saved with the picture because  if
  107.           you  just  zoomed in it is in the center of the picture, and
  108.           if you have not yet zoomed in, it would  be  pretty  useless
  109.           information.  
  110.  
  111.                When  you  hit  the ›3mcontinue ›0mgadget to start drawing, a
  112.           separate task is started to do the real work.    This  means
  113.           that  the main program (or task) of ›1mMandel ›0mruns concurrently
  114.           with the drawing task, so you  can  continue  selecting  the
  115.           palette, for  example.  All other things besides the drawing
  116.           is done in the main task, so  you  cannot  use  the  palette
  117.           while at  the  same  time  setting  the  pen  table.   Also,
  118.           changing some parameters  (such  as  the  pen  table)  takes
  119.           effect  immediately,  which  will change your picture in the
  120.           middle.  
  121.  
  122.                When the picture is being  drawn,  you  must  view  the
  123.           window  as  a  part  of the complex plane (that is the plane
  124.           formed by the real and imaginary axes).  The formula that is
  125.           selected in the functions menu is applied (for C the complex
  126.           value is filled in that corresponds to the  current  pixel),
  127.           with  Z  =  0,  and  the result is put into Z, recalculated,
  128.           until the absolute value reaches at least a  certain  value.
  129.  
  130.  
  131.      5 May 1989                       -2-
  132.  
  133.  
  134.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  135.  
  136.  
  137.           The  number  of  calculations  (or  iterations, or depth) is
  138.           counted, and the color to be drawn is looked up in  the  pen
  139.           table.   If  the  threshhold  value  is  not  reached in the
  140.           maximum number of iterations, entry #0 from the pen table is
  141.           used.  
  142.           Ideally, there should be an infinite iteration  to  find  if
  143.           the  value  ever  reaches infinity, but of course this is in
  144.           reality an impossible task.  Therefore, the higher  you  set
  145.           the  maximum  iteration  count, the better the drawn picture
  146.           will approximate  the  'real'  Mandelbrot  set.    In  fact,
  147.           Mandelbrot's  set  consists  of  those  complex numbers that
  148.           ›3mdon't   ›0mreach   infinity,   even   after   infinitely   many
  149.           iterations.   But  the  prettiest  pictures are usually from
  150.           near the border of Mandelbrot's set.  
  151.  
  152.      ›1mProject›0m: ›1mOpen 
  153.           ›0mYou can read any IFF picture (type FORM ILBM)  into  ›1mMandel›0m.
  154.           This  is  most useful if it is indeed a picture generated by
  155.           ›1mMandel›0m.  The pictures can  be  of  any  size,  and  will  be
  156.           clipped to  the current window as appropriate.  If it is too
  157.           small, the part of the window that is  not  covered  is  not
  158.           changed.  This is also true with extraneous bitplanes.  
  159.           Compatibility  with  files saved from V1.0 and V1.2 has been
  160.           insured.  
  161.  
  162.      ›1mProject›0m: ›1mSave 
  163.           ›0mIf you have saved the current picture before, you  can  save
  164.           it again.    That  is  also possible if you only changed the
  165.           current picture, that is, used ›1mfill in›0m.  
  166.  
  167.      ›1mProject›0m: ›1mSave As 
  168.           ›0msaves the contents of the  Mandelbrot  Construction  Window.
  169.           Together  with  the  picture,  some important information is
  170.           saved, such as the  area  of  the  ›1mMandelbrot  set  ›0mthat  is
  171.           contained  in  the  picture,  and the rainbow color palette.
  172.           (Previously, the ›3mscreen ›0mwas simply  dumped  into  the  file.
  173.           Also,  the  saved coordinate information was only correct if
  174.           you saved your pictures borderless and moved into the  upper
  175.           left corner.    These  misfeatures  have  been  corrected in
  176.           V1.1.) During a save, the drawing of a picture is suspended,
  177.           to prevent creating corrupt IFF files.  
  178.  
  179.      ›1mProject›0m: ›1mStop 
  180.           ›0mIf there is currently a picture  being  drawn,  the  drawing
  181.           stops.  Otherwise, nothing happens.  
  182.  
  183.      ›1mProject›0m: ›1mQuit 
  184.           ›0mYou may quit the program this way.  This can also be done by
  185.           clicking in  the  close  gadget.  ›1mMandel ›0mwill ask you if you
  186.           are sure, when you  have  not  saved  the  current  picture.
  187.           Sometimes, when memory is tight, the requester cannot be put
  188.           up, and  you would not be able to quit for this reason.  For
  189.           this case, an extra keyboard command (CTRL-Q) was added that
  190.           does NOT ask you if you are sure.  
  191.  
  192.      ›1mOptions›0m: ›1mColors 
  193.           ›0mWith this submenu, you can play  with  the  colors  and  the
  194.           coloration of pictures.  
  195.  
  196.  
  197.      5 May 1989                       -3-
  198.  
  199.  
  200.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  201.  
  202.  
  203.      ›1mOptions›0m: ›1mColors›0m: ›1mSelect 
  204.           ›0mIt  is  a way to individually select the pen number used for
  205.           each iteration count.  Currently, the values you select this
  206.           way are not yet saved with the picture.  You could, however,
  207.           write a batch file to set and restore the pen table.  Beware
  208.           that when you select one of the other ways of filling in the
  209.           pen table, the values you have selected here are lost.  
  210.           There is no way to undo accidental changes you made  to  the
  211.           pen table with this command, apart from the standard Amiga-Q
  212.           before you press Return.  
  213.  
  214.      ›1mOptions›0m: ›1mColors›0m: ›1mModulo 
  215.           ›0mmeans  that  the pen color used for a pixel is calculated by
  216.           taking the iteration  count  MOD  the  number  of  available
  217.           colors.  This is the default mode of operation.  
  218.  
  219.      ›1mOptions›0m: ›1mColors›0m: ›1mRanges 
  220.           ›0mis a  slightly  modified version of modulo.  The range width
  221.           is user selectable.   This  is  the  number  of  consecutive
  222.           iteration counts  that  produce the same pen number.  If you
  223.           set this to 1 you get  excactly  the  effect  you  get  with
  224.           modulo.   Starting from version 1.1, the pen table mode used
  225.           to generate a picture is saved with it.  
  226.  
  227.      ›1mOptions›0m: ›1mColors›0m: ›1mPalette 
  228.           ›0mA real color  palette,  that  you  may  recognise  from  the
  229.           Intuition  reference  Manual  and  Thomas  Wilcox's and =RJ=
  230.           Mical's Mandelbrot program.  I have  extended  it  somewhat,
  231.           and put a  hidden gadget to work.  Try hitting the RGB!  You
  232.           then meet the  ›1mrainbow  mode›0m.    Almost  everything  in  the
  233.           palette changes its function.  Try and have fun!  
  234.  
  235.      ›1mOptions›0m: ›1mResolution 
  236.           ›0mThis  submenu enables you to change two types of resolution:
  237.           the screen resolution, and the drawing resolution.   If  you
  238.           select  ›1m1›0m/›1m2›0m, ›1m1›0m/›1m3›0m, or ›1m1›0m/›1m4›0m, you may use ›1mfill in ›0mto fill in the
  239.           missing pixels.  ›1mBorderless ›0mis another  Special  Feature  of
  240.           ›1mMandel›0m: it can make the window borderless to gain some extra
  241.           pixels for  your  picure.  While you can't see them, all the
  242.           normal window gadgets are still functional in the  same  way
  243.           they were before.  So to start selecting a window frame, you
  244.           must ›3mstill  ›0mclick  in  the inner part of the window.  If you
  245.           select borderless, the picture will be preserved.  When  you
  246.           change  display  resolution,  your  current  picture will be
  247.           lost.  However, the size and location of your ›3mwindow ›0mwill be
  248.           preserved as well as possible.  Note that this can't be done
  249.           correctly in all cases.  Also note that  it  is  unavoidable
  250.           that the menus and requesters change in size and position if
  251.           you switch between Hi-res and Lo-res.  
  252.  
  253.      ›1mOptions›0m: ›1mParameters 
  254.           ›0mThis  puts  up  a requester to change some parameters of the
  255.           program.  Currently these  are  the  range  width  used  for
  256.           ›3mranges ›0mand  the maximum iteration count for every pixel.  It
  257.           may not be wise to alter parameters while a picure is  being
  258.           drawn.  
  259.           You  can  also  select  the size of the screen to be used by
  260.           ›1mMandel›0m.  The coordinates are expressed in default  Workbench
  261.  
  262.  
  263.      5 May 1989                       -4-
  264.  
  265.  
  266.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  267.  
  268.  
  269.           measures (hires  and non-interlaced).  The values you supply
  270.           are advisory only; a certain  minimum  size  is  taken  into
  271.           account.  
  272.  
  273.      ›1mOptions›0m: ›1mPriority 
  274.           ›0mWith  this  submenu  you  can  select two priorities for the
  275.           drawing task.  Normal means that the drawing  has  the  same
  276.           priority  as  the  main  task, low means that it is lower by
  277.           five.  This has the advantage  that  you  can  leave  ›1mMandel
  278.           ›0mdrawing  in  the  background, without slowing down any other
  279.           programs you would like to run.  
  280.  
  281.      ›1mDraw 
  282.           ›0mThis menu and its submenus let you choose what exactly  gets
  283.           drawn.   First, you can select the what calculation is to be
  284.           performed in the ›1mDraw›0m: ›1mFunc ›0mmenu.  Then there are two  kinds
  285.           of  plotting  functions  possible:  the first is called just
  286.           after each iteration of the  calculation  function,  and  is
  287.           therefore  called  ›1miplot›0m,  and the other is called after the
  288.           end of all iterations and is thus  called  ›1meplot›0m.    To  the
  289.           ›1meplot ›0mfunction is available the reached iteration count, the
  290.           end  value of Z, and the pixel we are currently considering.
  291.           To the ›1miplot  ›0mfunction  is  only  the  current  value  of  Z
  292.           available.  
  293.  
  294.      ›1mDraw›0m: ›1mFunc 
  295.           ›0mHere  you  can  select what function is used while iterating
  296.           complex values.  Only the first function is 'real',  (ie  it
  297.           is   ›1mMandelbrot›0m'›1ms   function›0m),   the   others  may  be  less
  298.           interesting and certainly also slower.  You  may  try  them,
  299.           however, if  you  like.  If you want to experiment, also see
  300.           the section on user-programmed functions  below.    Starting
  301.           from  version  1.1,  the  function number used to generate a
  302.           picture is saved with it.  
  303.           Only the functions marked ›1miplot  ›0mcall  the  iplot  function.
  304.           Especially  the  first Mandelbrot function does not call the
  305.           ›1miplot ›0mfunction, just to be slightly faster.  
  306.  
  307.      ›1mDraw›0m: ›1mIplot 
  308.           ›0mThis is the function that may be called during iterating the
  309.           calculation.  There are  currently  two  possibilities:  the
  310.           'empty'  function  that does nothing, and one that plots the
  311.           current value of Z on its proper place in the window.   This
  312.           is  done  by  incrementing  the color, so you can seen which
  313.           values of Z are plotted multiple times.  
  314.  
  315.      ›1mDraw›0m: ›1mEplot 
  316.           ›0mThis is the function that alwas is  called  after  iterating
  317.           the calculation.   You can either plot the current iteration
  318.           count (or depth), which is what you usually  would  want  to
  319.           do.   You  can  also  plot  the  value  of Z that caused the
  320.           iteration to terminate.  If it is  within  the  circle  with
  321.           radius  sqrt(8),  the  iteration  was  terminated because it
  322.           reached the maximum iteration count.  
  323.  
  324.      ›1mSOURCE 
  325.           ›0mYou should have gotten this program together with the source
  326.           in C. If you didn't, somebody somewhere along the path  from
  327.  
  328.  
  329.      5 May 1989                       -5-
  330.  
  331.  
  332.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  333.  
  334.  
  335.           me to you illegally left it out.  The document called ›1mNotice
  336.           ›0mspells out the redistribution criteria, one of which is that
  337.           the  source  must  always  be given with the program itself.
  338.           Another is, that when you use any part of  my  source  in  a
  339.           program  of  your  own, you must ›3malso ›0malways give the entire
  340.           source of your program with it.  
  341.  
  342.      ›1mPRECISION 
  343.           ›0mIt is important to know  that  there  are  two  versions  of
  344.           ›1mMandel ›0m(or  MbCS,  as  some  like to call it).  The one uses
  345.           single-precision, Motorola Fast Floating  Point,  the  other
  346.           uses double-precision,  IEEE  floating  point.   That is the
  347.           only difference between these versions.  The FFP version has
  348.           these letters in the screen title bar, and the  IEEE  Double
  349.           Precision  shows  DP  to  indicate  that  it  is the exacter
  350.           version of the two.  Using Fast Floating  Point  (FFP),  you
  351.           may    notice    (at   high   magnifications)   some   large
  352.           irregularities in lines that ought to be smooth.    Or  even
  353.           worse,  around  the  point 2.0 with a picture hight of about
  354.           1e-6, you go below the significance of single precision.  If
  355.           you see such distortions, you know it is time to start using
  356.           the double-precision version.  In  that  case,  remember  to
  357.           have the mathieeedoubbas.library in your LIBS: directory, or
  358.           ›1mMandel ›0mwill abort even before it really starts up.  
  359.  
  360.      ›1mREVISION 
  361.           ›0mThis  manual  describes ›1mMandel ›0mversion 1.3, revision 180. If
  362.           your version indicates a higher  number,  (in  the  ©  About
  363.           Mandel   menu)   it  presumably  has  been  upgraded/patched
  364.           officially.  A lower number indicates a version that is  out
  365.           of date.   For you source hackers: please select some random
  366.           negative revision number, and stick to it.  This  way  there
  367.           won't be any confusion about which version is which.  
  368.  
  369.      ›1mBATCH MODE 
  370.           ›0mUp  until  now,  I  have been discussing some pretty obvious
  371.           things.  But that changes right here:  now  come  the  ›3mbatch
  372.           mode   ›0mand  for  the  really  daring,  the  ›3muser  programmed
  373.           functions.  
  374.  
  375.           ›0mIf you invoke ›1mMandel ›0mwith a filename as argument, that  file
  376.           is   read  and  executed  after  ›1mMandel  ›0mopens  its  screen.
  377.           Alternatively, you can start a batch  file  from  the  BATCH
  378.           menu.  
  379.  
  380.      ›1mBatch›0m: ›1mWait 
  381.           ›0mIf  you  invoke  this  during execution of a batch file, its
  382.           execution will be suspended,  just  as  if  a  batch  'wait'
  383.           command was executed.  This also implies that the batch will
  384.           continue as soon as a picture finishes drawing.  
  385.  
  386.      ›1mBatch›0m: ›1mContinue 
  387.           ›0mThis will  simulate  finishing  a picture.  It will continue
  388.           the batch if it was waiting due to a wait  command  or  menu
  389.           selection.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.      5 May 1989                       -6-
  396.  
  397.  
  398.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  399.  
  400.  
  401.      ›1mBatch›0m: ›1mAbort 
  402.           ›0mIf  the  batch  is  running, it is aborted after the current
  403.           command finishes.  
  404.  
  405.           You can write a batch file with any normal text  editor  you
  406.           like,  as  long  as  it is able to write normal ASCII files.
  407.           The following batch commands are implemented: 
  408.  
  409.           ›3mdraw, fillin 
  410.  
  411.           ›0mstart the drawing.  The batch continues  while  the  drawing
  412.           takes place.  
  413.  
  414.           ›3mwait 
  415.  
  416.           ›0mstops the  batch  until  the drawing finishes.  It gives the
  417.           user a chance to operate ›1mMandel ›0min the mean time.    If  the
  418.           drawing   is   aborted,   the   batch   does   not  continue
  419.           automatically, but must be restarted with the batch continue
  420.           menu item.  
  421.  
  422.           ›3mleftedge, rightedge, topedge, bottomedge <real: value> 
  423.  
  424.           ›0mwhich take a single  real  argument,  and  set  the  obvious
  425.           thing.  
  426.  
  427.           ›3mstop 
  428.  
  429.           ›0mstops the drawing.  
  430.  
  431.           ›3mshift <real: hshift> <real: vshift> 
  432.  
  433.           ›0mtakes  two  real  arguments  (horizontal  and vertical shift
  434.           amount)  and  does  the  same  thing  as  the  project-shift
  435.           requester.  
  436.  
  437.           ›3mopen, saveas <string: filename> 
  438.  
  439.           ›0mtake  a string argument to load a picture from or to save it
  440.           in.  There is no save command with a default file name.  The
  441.           file name starts with the first  non-blank  character  after
  442.           the  command  and  includes  the  entire  rest  of  the line
  443.           (including spaces etc.), unless it is enclosed in single  or
  444.           double quotes (which cannot be escaped).  
  445.  
  446.           ›3mpixelstep, numcolors, maxdepth, rangewidth, wbwidth, 
  447.           wbheight <integer: value> 
  448.  
  449.           ›0mwhich take a single integral argument.  
  450.           ›3mPixelstep ›0mis the checkmarked menu items Normal (1), 2, 3 and
  451.           4, but  is  not limited to those values.  Be sure not to set
  452.           it to any value less than 1!  
  453.           ›3mNumcolors ›0mis not very useful; the value should be equal to 2
  454.           to the power (the number of planes), i.e.  16,  32,  or  64.
  455.           Maybe  interesting  to  change temporarily to affect the pen
  456.           table calculated by the modulo or ranges commands.  
  457.           ›3mMaxdepth ›0mand ›3mrangewidth ›0mare from the  parameters  requester,
  458.           and so are ›3mwbwidth ›0mand ›3mwbheight.  
  459.  
  460.  
  461. ›0m     5 May 1989                       -7-
  462.  
  463.  
  464.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  465.  
  466.  
  467.           ›3mborderless <integer: doit> 
  468.  
  469.           ›0mtakes  an  integral argument and makes the ›1mMandel ›0mwindow not
  470.           borderless when the value is 0 and borderless otherwise.  
  471.  
  472.           ›3mhires, interlace, halfbrite <integer: doit> 
  473.  
  474.           ›0mwork like borderless, but only take action when the  command
  475.           ›3mfixdisplay ›0mis given.  
  476.  
  477.           ›3mraindist, rainrmax, raingmax, rainbmax <integer: value> 
  478.  
  479.           ›0mtake  an integral argument, and select the appearance of the
  480.           rainbow palette.  The values must  not  exceed  the  current
  481.           number of available color registers (i.e. 16 or 32 depending
  482.           on screen   mode).    They  take  effect  when  the  command
  483.           ›3mfixrainbow ›0mis executed.  
  484.  
  485.           ›3mcolor <integer: register> <integer: r> <integer: g> 
  486.           <integer: b> 
  487.  
  488.           ›0mtakes 4 integral arguments: the color  register  number  and
  489.           the red, green and blue values.  It immediately changes that
  490.           color register.  
  491.  
  492.           ›3mdrawpri <integer: priority> 
  493.  
  494.           ›0mits integral argument is the amount to raise the priority of
  495.           the  drawing  task,  relative  to  the  priority of the main
  496.           task.  Only negative values are recommended.  It  is  unwise
  497.           to raise the drawing priority above the priority of the main
  498.           program, since in that case the main program, the batch, and
  499.           many  other  programs you might have running won't run until
  500.           the picture is finished.  If this command is given after the
  501.           drawing has started, it takes effect immediately.  
  502.  
  503.           ›3mselect <integer: depth> <integer: pen number> 
  504.  
  505.           ›0mtakes two values: the depth, and the corresponding pen color
  506.           to be set in the pen table.  This also sets the  "pen  table
  507.           mode" to select.  
  508.  
  509.           ›3mmodulo 
  510.  
  511.           ›0msets the pen table mode to modulo, and also recalculates the
  512.           pen table accordingly.  
  513.  
  514.           ›3mranges 
  515.  
  516.           ›0msets the pen table mode to ranges, and also recalculates the
  517.           pen  table  according to the currently selected range width,
  518.           as set with the ›3mrangewidth ›0mcommand.  
  519.  
  520.           ›3mfunction iplot eplot <integer: function number> 
  521.  
  522.           ›0mFunction  selects  which  function   you   want   to   draw.
  523.           Mandelbrot's  function  is number 1, and the other functions
  524.           from  the  menu  are  2  through  5,  respectively   (pretty
  525.  
  526.  
  527.      5 May 1989                       -8-
  528.  
  529.  
  530.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  531.  
  532.  
  533.           obvious!).  The User Programmed Function is number 4.  Iplot
  534.           and  eplot  select the iteration plot and end plot function,
  535.           respectively, also in the order as shown on the menu.  
  536.  
  537.           ›3mquit 
  538.  
  539.           ›0mExits ›1mMandel ›0mafter the batch file finishes, is  aborted,  or
  540.           executes a ›3mwait.  
  541.  
  542.           program, prelude 
  543.  
  544.           ›0mstart  the  definition  of a little program, to calculate an
  545.           alternative function.  The program or prelude  ends  with  a
  546.           line   with  only  ›3mend  ›0mon  it,  which  translates  into  an
  547.           end-of-program marker.  You must  always  define  a  prelude
  548.           before the  main  program.   If you re-define a main program
  549.           and a prelude  has  also  been  defined  earlier,  then  the
  550.           prelude  is  not  replaced  unless  you  (first)  explicitly
  551.           re-defined it.  For a description of the actual "programming
  552.           language" see its own section in this manual.  The  function
  553.           number you need to select (with the ›3mfunction ›0mcommand) is 4.  
  554.  
  555.           ›3mreg <integer: register number> <real: value> 
  556.  
  557.           ›0mSet a  register  of  the calculator to the given value.  You
  558.           could use this to supply some value for a parameter in  your
  559.           user programmed  function.  You can only set a real value so
  560.           the valid range  of  register  numbers  is  from  0  to  31,
  561.           inclusive.  
  562.  
  563.           ›3mbatch <string: file name> 
  564.  
  565.           ›0mends  processing the current batch file, and starts with the
  566.           named file.  [With ARexx, it is supposed to start the  given
  567.           rexx-macro asyncronously, but see the ARexx section.] 
  568.  
  569.           ›3m# ; / 
  570.  
  571.           ›0mcomment commands.   Any  remaining  text  is  ignored.  Both
  572.           shell and assembler comment symbols are supported, and the /
  573.           is included so you can write nice C-style /* comments */.  
  574.  
  575.           Batch peculiarities: 
  576.           - Error messages are not very helpful, and you don't  always
  577.           see  them  because  they  go  into a window on the Workbench
  578.           screen.  
  579.           - No range checking is done on supplied numeric values;  use
  580.           this freedom wisely.  
  581.           - Excess  arguments  or trailing spaces are usually ignored,
  582.           but don't count on this.  
  583.  
  584.      ›1mUSER PROGRAMMED FUNCTIONS 
  585.           ›0mIn addition to  the  three  functions  selectable  from  the
  586.           Draw:Func  menu,  you  can  program  your  own  in the batch
  587.           language.  This feature has been added just to be  uselessly
  588.           over-complete.  
  589.  
  590.                The  environment  for your function is exactly the same
  591.  
  592.  
  593.      5 May 1989                       -9-
  594.  
  595.  
  596.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  597.  
  598.  
  599.           as for the other functions:  you  need  not  (and  in  fact,
  600.           cannot)  specify  the  iterations,  or  the test against the
  601.           termination value.  
  602.  
  603.                To enable you to calculate your function, you can write
  604.           a program for a simple calculator.  That calculator  has  16
  605.           registers  for  complex  numbers (or you can use them for 32
  606.           real values), and real and complex operators for  assignment
  607.           (copy),  addition,  subtraction,  multiplication, and it can
  608.           put whole numbers into registers.  There is no provision  to
  609.           divide, since you could run the risk of dividing by zero.  
  610.           The  actual  procedure  followed to calculate a picture with
  611.           user programmed function is: 
  612.  
  613.              For each pixel in the window: 
  614.                 - Initialize registers 0, 2 and 3 to Z, C and Mouse 
  615.                 respectively.  
  616.                 - Execute the prelude.  
  617.                 - Then, while abs(Z) < some value, repeat: 
  618.                    - Register 1 has been initialized.  
  619.                    - Execute the main program.  
  620.                    - Call the iplot function.  
  621.                 - Call the eplot function, in which usually the number 
  622.                 of iterations decides which color the current pixel 
  623.                 should get.  
  624.  
  625.           The syntax for a single step in the computation is described
  626.           by the following regular expression: 
  627.  
  628.           { "r", "c" } ›3mdest ›0m"=" ›3mopnd1 ›0m[ { "i", "+", "-", "*" } ›3mopnd2 ›0m] 
  629.  
  630.           where  {  and  }   indicate   a   choice   between   several
  631.           alternatives,  stuff  between  [  and ] is optional, ›3mitalics
  632.           ›0mindicate a number to fill in, and text in  quotes  indicates
  633.           literal text that is required at that point.  
  634.           There  may  be  a  maximum  of  62  steps in the prelude and
  635.           program together.  
  636.  
  637.           The "r" or  "c"  select  the  type  of  operation:  ›3mreal  ›0mor
  638.           ›3mcomplex.   ›0mIn  case  of  ›3mreal  ›0moperations,  the  16  ›3mcomplex
  639.           ›0mregisters can be viewed as 32 ›3mreal ›0mregisters, with registers
  640.           0-15 containing the ›3mreal  parts,  ›0mand  registers  16-31  the
  641.           corresponding ›3mimaginary parts.  
  642.  
  643.           ›0mAs  said,  every line in the program is a single step in the
  644.           computation of your function.  Every step describes a simple
  645.           operation (*, + or -) on the values in  two  registers,  and
  646.           the  result  is  put  in  the  designated register after the
  647.           calculation.  ›3mDest ›0mis the number of the register to put  the
  648.           result of  the operation.  Likewise, ›3mopnd1 ›0mand ›3mopnd2 ›0mare the
  649.           numbers of the registers which give both  operands  for  the
  650.           operation (with the exception of the "i" operator).  So, for
  651.           example, the following program will be acceptable: 
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.      5 May 1989                       -10-
  660.  
  661.  
  662.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  663.  
  664.  
  665.  
  666.                ›3mprogram         
  667.                ›0mc 3 = 0 * 0
  668.                c 0 = 3 - 2
  669.                c 0 = 0 + 1
  670.                end
  671.  
  672.           Note  that the ›3mprogram ›0mnot really belongs to the program; it
  673.           is the batch command that indicates that a program  follows.
  674.           The 'end' on the other hand is a real instruction.  
  675.  
  676.           The *,  - and + do the obvious thing.  Remember, all numbers
  677.           here are the numbers of the registers involved.  
  678.  
  679.           With the "i" operator, you can form a  complex  number  from
  680.           two small  integral numbers.  (Small means ranging from -128
  681.           to +127, inclusive.) The first number is the real part,  and
  682.           the second  number  becomes  the  imaginary  part.    If the
  683.           operation is real instead of complex, the second  number  is
  684.           ignored, but  still required.  For future compatibility, you
  685.           should use 0 there.  
  686.  
  687.                There are four registers  with  a  predefined  meaning.
  688.           You can  use  the other 12 registers any way you like.  They
  689.           are not initialized to any particular value,  and  therefore
  690.           they  should  not  be  used  unless  you  set  them yourself
  691.           before.  
  692.  
  693.                Register 0 is meant as place  for  Z  in  the  formula.
  694.           Before  the  prelude it is initialized to 0 + i*0, and it is
  695.           not changed between iterations.  It is, however, examined to
  696.           see if the calculation is finished.    Therefore,  you  must
  697.           leave the result of your calculation here.  
  698.  
  699.                Register 1  is changed before each iteration.  The real
  700.           part contains the square of the real  part  of  Z,  and  the
  701.           imaginary  part contains the square of the imaginary part of
  702.           Z. These are calculated during the iteration check, so there
  703.           is no cost in making it available to you.  
  704.  
  705.                Register 2 contains C. It  is  initialized  before  the
  706.           prelude, and  it is not changed between iterations.  You may
  707.           change it if you feel this is necessary, though it is useful
  708.           if you use the provided value at least once.  You may notice
  709.           now that if you leave the  last  line  (before  the  ›3mend  ›0mof
  710.           course) off the above supplied example, you get a program to
  711.           calculate Mandelbrot's  function.    In fact, if you wish to
  712.           use it, you will find that it is not extremely  slower  than
  713.           what  you  would  get from using the optimized function from
  714.           the menu.  
  715.  
  716.                Register 3 contains the mouse position, as it was  last
  717.           shown  in  the  ›3mRe and Im ›0mwindow (or if you closed it, could
  718.           have been shown  there).    It  is  initialized  before  the
  719.           prelude, and  it is not changed between iterations.  You may
  720.           change it if you feel this is of no value to you.   You  can
  721.           produce  interesting  formulas  which  depend  on  the mouse
  722.           position.  Such a picture would be difficult  to  reproduce,
  723.  
  724.  
  725.      5 May 1989                       -11-
  726.  
  727.  
  728.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  729.  
  730.  
  731.           unless  you  arrange  to  save  the value in a high numbered
  732.           register in one prelude, and can use another  prelude  later
  733.           to retrieve the old value.  
  734.  
  735.                Registers 4 through 15 are free for you to use.  
  736.  
  737.                Another example.    It  is possible to define a prelude
  738.           and program to draw the Julia set belonging to a point.  For
  739.           those not familiar with Julia sets,  I'll  briefly  describe
  740.           their relations and differences with Mandelbrot's set.  
  741.           Both  sets  are based on the same function, Z = Z*Z - C. But
  742.           where in  Mandelbrot's  case  the  initial  value  of  Z  is
  743.           constant  (0)  and  C  varies  with  (corresponding to) each
  744.           pixel, for a  Julia  set  the  initial  value  of  Z  varies
  745.           corresponding to   each  pixel  and  C  is  constant.    For
  746.           different  values  of  C  you  get  different  pictures,  of
  747.           course.  
  748.  
  749.                The following prelude and program calculate a Julia set
  750.           with  for  C  the  location of the mouse when you select the
  751.           menu item to start drawing.  The value is visible in the  ›3mRe
  752.           and Im ›0mwindow.  
  753.  
  754.                ›3mprelude         
  755.                ›0m# This sets the initial value of Z
  756.                # to the current pixel
  757.                c 0 = 2
  758.                # Save C for later
  759.                c 15 = 3
  760.                end
  761.                # The following part is iterated:
  762.                ›3mprogram         
  763.                ›0m# Calculate Z*Z
  764.                c 4 = 0 * 0
  765.                # Calculate [Z*Z] - C
  766.                # Remember register 3 is the mouse position
  767.                c 0 = 4 - 3
  768.                end
  769.  
  770.                If  you  later want to re-use the same value for C, you
  771.           simply load another batch file with 'c 3 = 15' to restore  C
  772.           instead of  the  line  'c  15  =  3'.    It is currently not
  773.           possible to use floating point constants  in  your  program;
  774.           the  only  way  to  input them is with the mouse or with ›3mreg
  775.           ›0mcommands in a batch file.  
  776.  
  777.                Currently, the user programmed function  is  not  saved
  778.           with  the  picture,  only  the  fact  that  it  used  a user
  779.           programmed function.  This is no fatal  disadvantage,  since
  780.           is  no  way  to  look  at (or change) the function using the
  781.           menus of ›1mMandel›0m.  The standard  procedure  is  to  supply  a
  782.           batch  file  with  the  saved  picture which re-programs the
  783.           function used.  
  784.  
  785.      ›1mSLIGHTLY TESTED AREXX INTERFACE 
  786.           ›0mKnowing Rexx from VM/CMS systems [please note that Rexx  was
  787.           not  originally  invented by I*M], I wanted to make an ARexx
  788.           interface.  But there was one problem: I  don't  have  ARexx
  789.  
  790.  
  791.      5 May 1989                       -12-
  792.  
  793.  
  794.      Mandel(1)             AM*GA Programmer's Manual              Mandel(1)
  795.  
  796.  
  797.           myself.   But  then  along  came  MinRexx  [on Fish #188] by
  798.           Radical Eye Software (also known as  Tomas  Rokicki),  which
  799.           looked so  utterly  easy to use.  And necessary header files
  800.           and glue routines were supplied with DME [on Fish #168/169].
  801.           So, after examination of Tomas' code,  I  easily  added  the
  802.           MinRexx  interface  to  Mandel. It compiles, links, and even
  803.           runs.  Without ARexx. It creates a named message port, so at
  804.           least that part works.  But the rest?  I  didn't  know.    I
  805.           simply didn't know.  I asked someone with ARexx to give it a
  806.           try, and  he  told  that  it works.  But I cannot personally
  807.           guarantee that, nor give any hints about proplems one  might
  808.           experience.  
  809.  
  810.                Maybe somebody would care to donate me ARexx?  Because,
  811.           if it  does  not  work,  I cannot fix it.  May be I secretly
  812.           hope it does not work :-) 
  813.  
  814.                The intention is, by the  way,  that  batch  files  you
  815.           start  up,  either  via the Batch menu, or as a command line
  816.           parameter, are fed though ARexx, [and  if  that  fails,  are
  817.           done  the  same way as they are without ARexx interface] and
  818.           that  all  normal  batch  commands  are  accessible  through
  819.           ARexx.  
  820.  
  821.      ›1mREVISION HISTORY 
  822.           ›0mV1.3    2 Mar 1989 - 16 Apr 1989 
  823.           Added  batch  commands  prelude,  reg,  iplot,  eplot, stop.
  824.           Initialization of register #3. Zoom menu actions  (suggested
  825.           by Peter Larsen). Slightly tested ARexx interface.  
  826.           Supported when time permits.  
  827.  
  828.           V1.2    23 Jan 1989 - 29 Jan 1989 
  829.           Added user programmable functions, priority submenu (idea of
  830.           Peter Larsen).  Made string part in MAND chunk larger: Files
  831.           saved from V1.1 will work as if they were V1.0 files (and so
  832.           the info that was added in V1.1 is lost in the transition).  
  833.           Released. Not supported anymore.  
  834.  
  835.           V1.1    06 Jan 1989 - 22 Jan 1989 
  836.           Added  batch  mode,  selection  of screen size; removed most
  837.           annoying features of save from a  window  and  load  into  a
  838.           differently  sized  window than originally saved from; fixed
  839.           annoying  deadlock/crash  when  attempting  to  save  before
  840.           anything  had  been  drawn;  fixed incorrect IFF file format
  841.           with respect to MAND chunk; added more information  in  MAND
  842.           chunk  (function  number,  pen  table  mode, selected screen
  843.           size); finally did the select menu item.  
  844.           Not released.  Never supported.  
  845.  
  846.           V1.01   16 Sep 1987 
  847.           Quick check for graphics bug made a bit better.  
  848.           Not released.  No longer supported.  
  849.  
  850.           V1.0    15 Sep 1987 
  851.           Quick check for graphics bug.  
  852.           Released on Fish disk #111. No longer supported.  
  853.  
  854.  
  855.  
  856.  
  857.      5 May 1989                       -13-
  858.  
  859.